package com.plian.system.dao.fa.nplcancelmaintain;

import com.plian.Tools.pagedata.PageData;
import com.plian.system.dao.DaoSupport;
import com.plian.system.model.page.Page;
import com.plian.system.vo.pm.npl.AnnualStatisticalDetailVO;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
public class NPLCancelMaintainDao {
    @Resource(name = "daoSupport")
    private DaoSupport dao;

    /**
     * 新增
     *
     * @param pd
     * @throws Exception
     */
    public void save(PageData pd) throws Exception {
        dao.save("NPLCancelMaintainMapper.save", pd);
    }

    /**
     * 修改
     *
     * @param pd
     * @throws Exception
     */
    public void edit(PageData pd) throws Exception {
        dao.update("NPLCancelMaintainMapper.edit", pd);
    }

    /**
     * * 根据Id获取一条数据
     *
     * @param id
     * @return
     * @throws Exception
     */
    public PageData findById(String id) throws Exception {
        return (PageData) dao.findForObject("NPLCancelMaintainMapper.findById", id);
    }

    /**
     * 查询列表界面
     *
     * @return
     * @throws Exception
     */
    public List<PageData> list(Page page) throws Exception {
        return (List<PageData>) dao.findForList("NPLCancelMaintainMapper.datalistPage", page);
    }


    /**
     * 删除
     *
     * @param ids
     * @throws Exception
     */
    public void del_ids(List<String> ids) throws Exception {
        dao.delete("NPLCancelMaintainMapper.delete", ids);
    }

    /**
     * 修改状态
     *
     * @param pd
     */
    public void refer(PageData pd) throws Exception {
        dao.update("NPLCancelMaintainMapper.refer", pd);
    }

    /**
     * 查找多个ID
     *
     * @param pd
     */
    public List<PageData> findByIds(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("NPLCancelMaintainMapper.findByIds", pd);
    }

    /**
     * 根据多单位查询列表
     * @param page
     * @return
     * @throws Exception
     */
    public List<PageData> reportListPage(Page page) throws Exception {
        return (List<PageData>) dao.findForList("NPLCancelMaintainMapper.reportListPage",page);
    }

    /**
     * * 以备案号排序的年度核销备案统计明细
     *
     * @param id
     * @return
     * @throws Exception
     */
    public List<AnnualStatisticalDetailVO> annualStatisticalDetailById(String id) throws Exception {
        return (List<AnnualStatisticalDetailVO>) dao.findForList("NPLCancelMaintainMapper.annualStatisticalDetailById", id);
    }
}
